load("@io_bazel_rules_go//go:def.bzl", "go_library", "go_test")

# we add this rule so users can `bazel build //test/e2e` to run a
# platform-independent version of the e2e test binary
genrule(
    name = "e2e",
    testonly = True,
    srcs = [":go_default_test"],
    outs = ["e2e.test"],
    cmd = "cp $(SRCS) $@",
    visibility = ["//visibility:public"],
)

go_library(
    name = "go_default_library",
    srcs = ["e2e.go"],
    importpath = "github.com/jetstack/cert-manager/test/e2e",
    tags = ["manual"],
    visibility = ["//visibility:public"],
    deps = [
        "//test/e2e/framework:go_default_library",
        "//test/e2e/framework/addon:go_default_library",
        "//test/e2e/framework/log:go_default_library",
        "@com_github_onsi_ginkgo//:go_default_library",
    ],
)

go_test(
    name = "go_default_test",
    srcs = ["e2e_test.go"],
    embed = [":go_default_library"],
    tags = ["manual"],  # 'bazel test //...' should not run e2e tests
    deps = [
        "//pkg/logs:go_default_library",
        "//test/e2e/framework:go_default_library",
        "//test/e2e/suite:go_default_library",
        "@com_github_onsi_ginkgo//:go_default_library",
        "@com_github_onsi_ginkgo//config:go_default_library",
        "@com_github_onsi_ginkgo//reporters:go_default_library",
        "@com_github_onsi_gomega//:go_default_library",
        "@io_k8s_apimachinery//pkg/util/wait:go_default_library",
    ],
)

filegroup(
    name = "package-srcs",
    srcs = glob(["**"]),
    tags = ["automanaged"],
    visibility = ["//visibility:private"],
)

filegroup(
    name = "all-srcs",
    srcs = [
        ":package-srcs",
        "//test/e2e/bin/cloudflare-clean:all-srcs",
        "//test/e2e/framework:all-srcs",
        "//test/e2e/suite:all-srcs",
        "//test/e2e/util:all-srcs",
    ],
    tags = ["automanaged"],
    visibility = ["//visibility:public"],
)
